import graceChecker from './graceChecker'
import { Toast } from 'vant';

// 来自 graceUI 的表单验证， 使用说明见手册 http://grace.hcoder.net/doc/info/73-3.html
export default function (formData, rule, showError = true) {
  const checkRes = graceChecker.check(formData, rule)

  if (checkRes) {
    return true
  } else {
    if (showError) Toast(graceChecker.error)

    return graceChecker.error
  }
}
